package com.servlet;

import com.dao.imp.AddUpdDelDaoImp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * @author Mathison
 * @Title: ${NAME}
 * @Package: ${PACKAGE_NAME}
 * @Description: TODO
 * @date 2021/11/24 17:56
 **/

@WebServlet(name = "PullOffGoodServlet", value = "/PullUpOffGoodServlet")
public class PullUpOffGoodServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        int status = Integer.parseInt(request.getParameter("status"));
//        System.out.println(id+"status:"+status);

        String sql = "UPDATE goods  SET status = "+status+" WHERE good_id = "+id;
        AddUpdDelDaoImp addUpdDelDaoImp = new AddUpdDelDaoImp();
        addUpdDelDaoImp.addUpdDelGoods(sql);
    }
}
